export const Tip = {
    tipSuccess(res: any, msg: string, data: any = null) {
        return res.json({ msg, code: 200, data })
    },
    tipError(res: any, msg: any, data: any = null) {
        return res.json({ msg, code: 0, data })
    },
    tipError500(res: any, err: any) {
        return res.status(500).send(err);
    }
}
/**
 * sql操作数据库封装
 */
export const Sql = {
    set(values: object, filiter?: string[]) {
        let set = '';
        let len = Object.keys(values).length;
        Object.keys(values).forEach((key, index) => {
            if (key == 'id') return;
            if (filiter && filiter.includes(key)) return;
            const douhao = len == index + 1 ? '' : ','
            set += `${key} = '${values[key]}'` + douhao;
        })
        return set;
    }
}